.class public Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;
.super Landroidx/recyclerview/widget/RecyclerView$Adapter;
.source "MainMenuAdapter.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$b;,
        Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;
    }
.end annotation


# instance fields
.field private final a:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/jecelyin/editor/v2/view/menu/c;",
            ">;"
        }
    .end annotation
.end field

.field private final b:Landroid/view/LayoutInflater;

.field private c:Z

.field private d:Landroid/content/Context;

.field private e:[I

.field private f:Z

.field private g:Landroid/view/MenuItem$OnMenuItemClickListener;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 12

    .line 1
    invoke-direct {p0}, Landroidx/recyclerview/widget/RecyclerView$Adapter;-><init>()V

    const/4 v0, 0x1

    .line 2
    iput-boolean v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->f:Z

    .line 3
    invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    iput-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->b:Landroid/view/LayoutInflater;

    .line 4
    iput-object p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->d:Landroid/content/Context;

    .line 5
    invoke-direct {p0, p1}, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a(Landroid/content/Context;)V

    .line 6
    invoke-static {p1}, Lcom/jecelyin/editor/v2/view/menu/b;->a(Landroid/content/Context;)Lcom/jecelyin/editor/v2/view/menu/b;

    move-result-object p1

    .line 7
    invoke-static {}, Lcom/jecelyin/editor/v2/view/menu/MenuGroup;->values()[Lcom/jecelyin/editor/v2/view/menu/MenuGroup;

    move-result-object v0

    .line 8
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a:Ljava/util/List;

    .line 9
    array-length v1, v0

    const/4 v2, 0x0

    :goto_0
    if-ge v2, v1, :cond_1

    aget-object v9, v0, v2

    .line 10
    invoke-virtual {v9}, Lcom/jecelyin/editor/v2/view/menu/MenuGroup;->getNameResId()I

    move-result v3

    if-nez v3, :cond_0

    goto :goto_1

    .line 11
    :cond_0
    iget-object v10, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a:Ljava/util/List;

    new-instance v11, Lcom/jecelyin/editor/v2/view/menu/c;

    const/4 v5, 0x0

    sget-object v6, Lcom/jecelyin/editor/v2/common/Command$CommandEnum;->NONE:Lcom/jecelyin/editor/v2/common/Command$CommandEnum;

    const/4 v7, 0x0

    const/4 v8, 0x0

    move-object v3, v11

    move-object v4, v9

    invoke-direct/range {v3 .. v8}, Lcom/jecelyin/editor/v2/view/menu/c;-><init>(Lcom/jecelyin/editor/v2/view/menu/MenuGroup;ILcom/jecelyin/editor/v2/common/Command$CommandEnum;II)V

    invoke-interface {v10, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 12
    iget-object v3, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a:Ljava/util/List;

    invoke-virtual {p1, v9}, Lcom/jecelyin/editor/v2/view/menu/b;->a(Lcom/jecelyin/editor/v2/view/menu/MenuGroup;)Ljava/util/List;

    move-result-object v4

    invoke-interface {v3, v4}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    :goto_1
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    return-void
.end method

.method private a(ILcom/jecelyin/editor/v2/view/menu/c;Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;)Landroid/graphics/drawable/Drawable;
    .locals 4

    .line 3
    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/c;->getItemId()I

    move-result p1

    .line 4
    iget-boolean v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->f:Z

    const/4 v1, 0x0

    const/4 v2, 0x2

    const/4 v3, 0x1

    if-nez v0, :cond_2

    .line 5
    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_redo:I

    if-ne p1, v0, :cond_1

    .line 6
    iget-boolean p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->c:Z

    if-eqz p1, :cond_0

    .line 7
    iget-object p1, p3, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;

    invoke-virtual {p1}, Landroid/view/View;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/c;->c()I

    move-result p2

    invoke-static {p1, p2}, Lcom/jecelyin/editor/v2/ui/e;->a(Landroid/content/res/Resources;I)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    .line 8
    iget-object p2, p3, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    iget-object p3, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget p3, p3, v3

    invoke-virtual {p2, p3}, Landroid/widget/TextView;->setTextColor(I)V

    goto/16 :goto_1

    .line 9
    :cond_0
    iget-object p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->d:Landroid/content/Context;

    .line 10
    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/c;->c()I

    move-result p2

    iget-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget v0, v0, v2

    invoke-static {p1, p2, v0}, Lcom/jecelyin/common/utils/a;->a(Landroid/content/Context;II)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    .line 11
    iget-object p2, p3, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    iget-object p3, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget p3, p3, v1

    invoke-virtual {p2, p3}, Landroid/widget/TextView;->setTextColor(I)V

    goto :goto_1

    .line 12
    :cond_1
    iget-object p1, p3, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;

    invoke-virtual {p1}, Landroid/view/View;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/c;->c()I

    move-result p2

    invoke-static {p1, p2}, Lcom/jecelyin/editor/v2/ui/e;->a(Landroid/content/res/Resources;I)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    .line 13
    iget-object p2, p3, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    iget-object p3, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget p3, p3, v3

    invoke-virtual {p2, p3}, Landroid/widget/TextView;->setTextColor(I)V

    goto :goto_1

    .line 14
    :cond_2
    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_save:I

    if-eq p1, v0, :cond_4

    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_save_all:I

    if-eq p1, v0, :cond_4

    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_redo:I

    if-eq p1, v0, :cond_4

    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_wrap:I

    if-eq p1, v0, :cond_4

    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_color:I

    if-ne p1, v0, :cond_3

    goto :goto_0

    .line 15
    :cond_3
    iget-object p1, p3, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;

    invoke-virtual {p1}, Landroid/view/View;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/c;->c()I

    move-result p2

    invoke-static {p1, p2}, Lcom/jecelyin/editor/v2/ui/e;->a(Landroid/content/res/Resources;I)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    .line 16
    iget-object p2, p3, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    iget-object p3, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget p3, p3, v3

    invoke-virtual {p2, p3}, Landroid/widget/TextView;->setTextColor(I)V

    goto :goto_1

    .line 17
    :cond_4
    :goto_0
    iget-object p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->d:Landroid/content/Context;

    .line 18
    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/c;->c()I

    move-result p2

    iget-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget v0, v0, v2

    invoke-static {p1, p2, v0}, Lcom/jecelyin/common/utils/a;->a(Landroid/content/Context;II)Landroid/graphics/drawable/Drawable;

    move-result-object p1

    .line 19
    iget-object p2, p3, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    iget-object p3, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    aget p3, p3, v1

    invoke-virtual {p2, p3}, Landroid/widget/TextView;->setTextColor(I)V

    :goto_1
    return-object p1
.end method

.method static synthetic a(Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;)Landroid/view/MenuItem$OnMenuItemClickListener;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->g:Landroid/view/MenuItem$OnMenuItemClickListener;

    return-object p0
.end method

.method private a(Landroid/content/Context;)V
    .locals 3

    const/4 v0, 0x3

    new-array v0, v0, [I

    .line 20
    sget v1, Lcom/jecelyin/editor/v2/f;->Alpha20TextColor:I

    const/4 v2, 0x0

    aput v1, v0, v2

    sget v1, Lcom/jecelyin/editor/v2/f;->Alpha60TextColor:I

    const/4 v2, 0x1

    aput v1, v0, v2

    sget v1, Lcom/jecelyin/editor/v2/f;->mainMenuDisableIconColor:I

    const/4 v2, 0x2

    aput v1, v0, v2

    .line 21
    invoke-static {p1, v0}, Lcom/jecelyin/editor/v2/utils/i;->a(Landroid/content/Context;[I)[I

    move-result-object p1

    iput-object p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->e:[I

    return-void
.end method


# virtual methods
.method public a(Landroid/view/MenuItem$OnMenuItemClickListener;)V
    .locals 0

    .line 2
    iput-object p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->g:Landroid/view/MenuItem$OnMenuItemClickListener;

    return-void
.end method

.method public a(Z)V
    .locals 0

    .line 22
    iput-boolean p1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->f:Z

    .line 23
    invoke-virtual {p0}, Landroidx/recyclerview/widget/RecyclerView$Adapter;->notifyDataSetChanged()V

    return-void
.end method

.method public getItemCount()I
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a:Ljava/util/List;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    goto :goto_0

    :cond_0
    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    :goto_0
    return v0
.end method

.method public getItemViewType(I)I
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/jecelyin/editor/v2/view/menu/c;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/view/menu/c;->getItemId()I

    move-result v0

    if-nez v0, :cond_0

    const/4 p1, 0x1

    goto :goto_0

    :cond_0
    invoke-super {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$Adapter;->getItemViewType(I)I

    move-result p1

    :goto_0
    return p1
.end method

.method public onBindViewHolder(Landroidx/recyclerview/widget/RecyclerView$ViewHolder;I)V
    .locals 3

    .line 1
    iget-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a:Ljava/util/List;

    invoke-interface {v0, p2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/jecelyin/editor/v2/view/menu/c;

    .line 2
    instance-of v1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;

    if-eqz v1, :cond_2

    .line 3
    check-cast p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;

    .line 4
    iget-object v1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/view/menu/c;->d()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/widget/TextView;->setText(I)V

    .line 5
    invoke-direct {p0, p2, v0, p1}, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->a(ILcom/jecelyin/editor/v2/view/menu/c;Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;)Landroid/graphics/drawable/Drawable;

    move-result-object p2

    .line 6
    iget-object v1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->a:Landroid/widget/TextView;

    const/4 v2, 0x0

    invoke-virtual {v1, p2, v2, v2, v2}, Landroid/widget/TextView;->setCompoundDrawablesWithIntrinsicBounds(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V

    .line 7
    iget-object p2, p1, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;

    const/4 v1, 0x1

    invoke-virtual {p2, v1}, Landroid/view/View;->setFocusable(Z)V

    .line 8
    iget-object p2, p1, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;

    new-instance v1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$a;

    invoke-direct {v1, p0, v0}, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$a;-><init>(Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;Lcom/jecelyin/editor/v2/view/menu/c;)V

    invoke-virtual {p2, v1}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 9
    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/view/menu/c;->getItemId()I

    move-result p2

    .line 10
    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_highlight:I

    const/4 v1, 0x0

    if-ne p2, v0, :cond_0

    iget-object v0, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->d:Landroid/content/Context;

    invoke-static {v0}, Lcom/jecelyin/editor/v2/d;->a(Landroid/content/Context;)Lcom/jecelyin/editor/v2/d;

    move-result-object v0

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/d;->q()Z

    move-result v0

    if-nez v0, :cond_0

    .line 11
    iget-object p1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->b:Landroid/view/View;

    invoke-virtual {p1, v1}, Landroid/view/View;->setVisibility(I)V

    goto :goto_0

    .line 12
    :cond_0
    sget v0, Lcom/jecelyin/editor/v2/j;->je_m_theme:I

    if-ne p2, v0, :cond_1

    iget-object p2, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->d:Landroid/content/Context;

    invoke-static {p2}, Lcom/jecelyin/editor/v2/d;->a(Landroid/content/Context;)Lcom/jecelyin/editor/v2/d;

    move-result-object p2

    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/d;->r()Z

    move-result p2

    if-nez p2, :cond_1

    .line 13
    iget-object p1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->b:Landroid/view/View;

    invoke-virtual {p1, v1}, Landroid/view/View;->setVisibility(I)V

    goto :goto_0

    .line 14
    :cond_1
    iget-object p1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;->b:Landroid/view/View;

    const/16 p2, 0x8

    invoke-virtual {p1, p2}, Landroid/view/View;->setVisibility(I)V

    goto :goto_0

    .line 15
    :cond_2
    check-cast p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$b;

    .line 16
    iget-object p1, p1, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$b;->a:Landroid/widget/TextView;

    invoke-virtual {v0}, Lcom/jecelyin/editor/v2/view/menu/c;->b()Lcom/jecelyin/editor/v2/view/menu/MenuGroup;

    move-result-object p2

    invoke-virtual {p2}, Lcom/jecelyin/editor/v2/view/menu/MenuGroup;->getNameResId()I

    move-result p2

    invoke-virtual {p1, p2}, Landroid/widget/TextView;->setText(I)V

    :goto_0
    return-void
.end method

.method public onCreateViewHolder(Landroid/view/ViewGroup;I)Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
    .locals 3

    const/4 v0, 0x0

    const/4 v1, 0x1

    if-ne p2, v1, :cond_0

    .line 1
    new-instance p2, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$b;

    iget-object v1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->b:Landroid/view/LayoutInflater;

    sget v2, Lcom/jecelyin/editor/v2/k;->je_main_menu_group:I

    invoke-virtual {v1, v2, p1, v0}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object p1

    invoke-direct {p2, p1}, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$b;-><init>(Landroid/view/View;)V

    return-object p2

    .line 2
    :cond_0
    new-instance p2, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;

    iget-object v1, p0, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter;->b:Landroid/view/LayoutInflater;

    sget v2, Lcom/jecelyin/editor/v2/k;->je_main_menu_item:I

    invoke-virtual {v1, v2, p1, v0}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object p1

    invoke-direct {p2, p1}, Lcom/jecelyin/editor/v2/adapter/MainMenuAdapter$c;-><init>(Landroid/view/View;)V

    return-object p2
.end method
